<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../../../inc/conn.asp"-->
<%const link="hot"

id=checkstr(inHTML(request("id")))
sort=checkstr(inHTML(request.QueryString("sort")))
if id="" or not isnumeric(id)  then
response.Write("<script>window.location.href='/';</script>")
response.End()
else 
set rs=server.CreateObject("adodb.recordset")
sql="select * from protype where mark=1 and id="&id&""
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.Write("<script>window.location.href='/';</script>")
response.End
else
typeid=rs("id")
typekey=rs("key")
typedesc=rs("desc")
typetitle=rs("title")
end if
rs.close
set rs=nothing
end if

'读取路径
typelink_id=typeid
For s=1 to 6
	set rss=conn.execute("select fid,id,title from protype where id="&typelink_id&"")
	if not rss.eof then
	   typelink_id=rss("fid")
	   typelink=" > <a href='/shopping/"&rss("id")&"'>"&rss("title")&"</a>"+typelink
	set rss=nothing
	end if
Next


if typeid<>"" then
  sqlsearch=sqlsearch+" and ([type]="&typeid&" or [type] in(select id from protype where fid="&typeid&") or [type] in(select id from protype where fid in(select id from protype where fid="&typeid&")))"
end if 

'分页-------------------------------------------------------
set Rs=server.CreateObject("ADODB.RecordSet")
sql="select count(sortid) from (Select ROW_NUMBER() OVER (order by pid desc) as sortid,* From product) as TempTable where 1=1 and Delflag=1 and mark=1 "&sqlsearch&""
Pager_Pagesize=7 '每页记录数
Rs.open sql,conn,1,1
Pager_TotalRecord=Rs(0) '总记录数
Rs.close
Pager_PageCount=int((Pager_TotalRecord/Pager_Pagesize)+0.99999) '计算总页数
CurrentPage=Request("page") '当前页
if isnumeric(CurrentPage)=false then CurrentPage=1
if CurrentPage=0 then CurrentPage=1
if CurrentPage="" then CurrentPage=1
'如果不为数字则直接设置页码为1
if isnumeric(CurrentPage)=False Or CurrentPage="" then
	CurrentPage=1
'如果当前页数大于总页数，则直接设置页码为1
elseif  Clng(CurrentPage)>Pager_PageCount then
	CurrentPage=1
end if
Fieldsname=" pid,title,jptitle,pic,sortid"
orderBy=" Order by sortid asc"
'拆分SQL语句，必须是select开头，有唯一标识的列
if instr("select",sql)<>-1 then
	if CurrentPage = 1 then
		sql = replace(sql,"select count(sortid)"," select  top " & Pager_Pagesize  & Fieldsname)
	else  
		sql = replace(sql,"select count(sortid)"," select  top " & Pager_Pagesize   & Fieldsname) & " and sortid >(select max(sortid) from (" & replace(sql,"select count(sortid)"," select  top " & Pager_Pagesize * (CurrentPage - 1)  & Fieldsname) & orderBy & ") AA)"
	end if
end if
sql = sql & orderBy
Rs.open sql,conn,1,1


  '分页 
  UrlView="/shopping/"&typeid&"?s=t&"
  if CurrentPage<=1 then
  pageview="<a class='prev_page'> < </a>"
  else
  pageview="<a href='"&UrlView&"page="&CurrentPage-1&"'> < </a>"
  end if
  if CurrentPage>=7 then
  pageview=pageview+"<a href='"&UrlView&"page=1'>1</a><a>...</a>"
  end if
  if Pager_PageCount<4 then NumPage=Pager_PageCount else NumPage=4
  for tp = -4 to NumPage
  if Pager_PageCount>=tp+CurrentPage and tp+CurrentPage=>1  then 
  if trim(tp+CurrentPage)=CurrentPage or tp=0 then
  pageview=pageview+"<a class='cur_page'>"&tp+CurrentPage&"</a>"
  else
  pageview=pageview+"<a"&pagecss&" href='"&UrlView&"page="&tp+CurrentPage&"'>"&tp+CurrentPage&"</a>"
  end if
  end if
  next
  if Pager_PageCount>tp+CurrentPage then pageview=pageview+"<a>...</a>"
  if Pager_PageCount<CurrentPage+1 then
  pageview=pageview+"<a class='prev_page'> > </a>"
  else
  pageview=pageview+"<a href='"&UrlView&"page="&CurrentPage+1&"'> > </a>"
  end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><%=typekey%></title>
<meta name="keywords" content="<%=typekey%>" />
<meta name="description" content="<%=typedesc%>" />
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon"/>
<link rel="stylesheet" type="text/css" href="/css/style.css" />
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){ 
	$('#select_1').change(function(){ 
		$('#search_1').val($(this).find("option:selected").text());
	});
}); 
$(function (){
  $(".main_class_li").hover(function(){
	$(".child_class",this).show();
  });
  $(".main_class_li").mouseleave(function(){
	$(".child_class",this).hide();
  });
});
</script>
</head>
<body>


<!--#include file="../../common/topshopping.asp"-->




<div class="clear20"></div>



<!--main-->
<div class="fullwidth bg1">
	<div class="main">
		
        
        
        <!--#include file="common/left.asp"--> 
        
        
        
        
        	
		<div class="jp_middle">
			<h2 class="jp_h2_2"><a href="/shopping">商品分类</a> <%=typelink%>　</h2>
			<div class="jp_m_box_1 dg_m_box_1">
				<ul class="m_class">
					  <%
					  set rslist=server.CreateObject("adodb.recordset")
					  sql="select * from protype where fid="&id&" order by sort asc,id desc"
					  rslist.open sql,conn,1,3
					  if not rslist.eof then
					  do while not rslist.eof
					  response.Write "<li><a href='/shopping/"&rslist("id")&"'>• "&rslist("title")&"</a></li>"
					  rslist.movenext
					  loop
					  rslist.close
					  set rslist=nothing
					  end if		 
					  %> 
				</ul>
			</div>
			<div class="clear10"></div>
			<div class="jp_m_box_1 dg_m_box_1">
				<div class="page_2">
					<span>总共<%=Pager_PageCount%>页第<%=CurrentPage%>页</span>
					<div class="page">
						<%=pageview%>
					</div>
				</div>
				<div class="clear10"></div>
				<table class="stable jp_table_1">
					<tr class="str">
						<th class="th_1">商品名</th>
						<th>商品价格</th>
						<th>商品来源</th>			
					</tr>
					<%do while not Rs.eof
					  set rss=server.CreateObject("adodb.recordset")
					  sql="select * from Source where istop=1 and pid="&rs("pid")&""
					  rss.open sql,conn,1,3
					  if not rss.eof then
					  set rsc=conn.execute("select title from shop where sid="&rss("sid")&"")
					%>
					<tr>
						<td>
							<dl>
								<dt><a href="/shopping/<%=rs("pid")%>.html"><img src="<%=rs("pic")%>" width="99" height="100" alt=""></a></dt>
								<dd><a href="/shopping/<%=rs("pid")%>.html"><%=rs("title")%></a></dd>
								<dd><a href="/shopping/<%=rs("pid")%>.html"><%=rs("jptitle")%> </a></dd>
							</dl>
						</td>
						<td><%=rss("price")%>日元</td>
						<td><%=rsc("title")%></td>
					</tr>
                    <%
					  set rsc=nothing
					  rss.close
					  set rss=nothing
					  end if
					Rs.movenext
					loop
					Rs.close
					Set Rs=nothing
					%>
					
				</table>
				<div class="clear10"></div>
				<div class="page_2">
					<span>总共<%=Pager_PageCount%>页第<%=CurrentPage%>页</span>
					<div class="page">
						<%=pageview%>
					</div>
				</div>
				<div class="clear20"></div>
			</div>
		</div>	
		
        
        
        
        
        <!--#include file="common/right.asp"--> 
        
        
        
        	
	</div>
</div>

<div class="clear"></div>




<!--#include file="../../common/footerauctions.asp"-->



</body>
</html>